import type { StyleValue } from 'vue'
import type { EChartsOption } from 'echarts'
import type componentMap from './components'
import type { SettingType } from '@/components'

export interface BaseConfigs {
  title?: string
  events?: Record<string, any>
  chartOption?: EChartsOption
  animations?: string[]
  themeColor?: string
  style?: StyleValue
}

export interface CustomComponent<T extends Record<string, any> = object> {
  id: string
  type: string
  component: keyof typeof componentMap
  label: string
  icon: string
  configs?: BaseConfigs & T
  settings?: SettingType[]
}

export interface ComponentConfig {
  title?: string
  icon?: string
  list?: {
    name: string
    components: CustomComponent[]
  }[]
}
